/**
 * Created by hiephn on 2014/08/26.
 */
define(['durandal/app', 'shell'],function (app, shell) {
    var FEED_URL = app.conf.MNP_BACK_URL + "/feed",
        self = null,
        feedTemplate = {
        "id": 1,
        "name": "Loading",
        "desc": "Loading",
        "pubDate": null,
        "lastUpdate": null,
        "link": null,
        "imgUrl": null,
        "author": null,
        "minRead": 0,
        "hot": 0,
        "likeNo": 0,
        "shareNo": 0,
        "commentNo": 0
    };
    var VM = {
        feeds: app.koa([app.koMap.fromJS(feedTemplate)]),
        channelFas: app.cache.channelFas,
        providerNames: app.cache.providerNames,
        title: 'Home',
        activate: function() {
            self = this;
            app.http.get(
                FEED_URL, {
                    page: 0
                }, {
                    success: function(json) {
                        app.koMap.fromJS(json.dataList, {}, self.feeds);
                    }
                }
            );
        },
        canDeactivate: function() {
        }
    };
    return VM;
});
